package aiguigu08.constructor.exer3;

/**
 * ClassName: CustomerTest
 * Package: aiguigu08.constructor.exer3
 * Description:
 *
 * @Author ZY
 * @Create 2024/10/11 22:17
 * @Version 1.0
 */
public class CustomerTest {
    public static void main(String[] args) {

        Customer customer = new Customer("Jane","Smith");

        //1.
//        Account account = new Account(1000,2000,0.0123);
//        //客户与账户建立联系
//        customer.setAccount(account);

        //2.
        customer.setAccount(new Account(1000,2000,0.0123));

        //存钱、取钱
        customer.getAccount().deposit(100);
        customer.getAccount().withdraw(960);
        customer.getAccount().withdraw(2000);

        //
        System.out.println("Customer [" + customer.getFirstName() + "," + customer.getLastName() +
                "] has a account: id is " + customer.getAccount().getId() + ",annuallnterestRate is " +
                customer.getAccount().getAnnuallnterestRate() * 100 + "%,balance is " +
                customer.getAccount().getBalance());


    }
}
